<template>
	<view>
		<!-- 头像 -->
		<u-avatar :src="src"></u-avatar>
		<view v-if="user==null ">
			<text @click="loginInfo()">点击登录</text>
		</view>
		<view v-else>
			<text :text="name"></text>
		</view>

		<!-- 单元格跳转页面 -->
		<u-cell-group>

			<u-cell title="我的订单" @click="toMyOrder"></u-cell>
			<u-cell title="收藏电站" @click="toMySelect"></u-cell>
			<!-- 退出弹出框 -->
			<view>
				<u-popup :show="show" mode="center" @click="show = false">
					<view>
						<u-button @click="quit" type="success">退出</u-button>
					</view>
				</u-popup>
				<u-button @click="show = true">退出</u-button>
			</view>
		</u-cell-group>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				src: 'https://img95.699pic.com/desgin_photo/40214/3525_list.jpg',
				user: null,
				show: false,
				name:""
			}
		},
		methods: {
			toMySelect(){
				uni.navigateTo({
					url: "/pages/view/mySelect/mySelect"
				})
			},
			toMyOrder(){
				uni.navigateTo({
					url: "/pages/view/myOrder/myOrder"
				})
			},
			loginInfo() {
				uni.navigateTo({
					url: "/pages/view/login/login"
				})
			},
			quit(){
				console.log("quit")
			}
		},
		onShow() {
			let nickName=uni.getStorageSync("nickName");
			let that=this;
			that.name=nickName;
		}
	}
</script>

<style>

</style>
